package com.hoshiicloud.as2c.minipro.feign;

/**
 * @Author:campchen
 * @Date:Created in 下午 07:09 2019/6/27
 * @PACKAGENAME com.hoshiicloud.miniapp.feign
 * @Description
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.as2c.minipro.dto.*;
import com.hoshiicloud.as2c.minipro.feign.hystrix.HystrixUserFeignFallback;
import com.hoshiicloud.as2c.minipro.param.MemberAddressPageParam;
import com.hoshiicloud.as2c.minipro.param.MemberAddressUpdateParam;
import com.hoshiicloud.as2c.minipro.param.PlatStoreQueryParam;
import com.hoshiicloud.common.rpc.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "hoshiicloud-user", fallback = HystrixUserFeignFallback.class)
public interface UserService {


	@PostMapping(value = "/store/storeRangeCalculation")
	Response<Page<Map<String, Object>>> StoreRangeCalculation(@RequestBody StoreRangeCalculationDTO param);

	@GetMapping(value = "/store/plat-store/{id}")
	Response<PlatStoreDTO> queryById(@PathVariable("id") Long id);

	@PostMapping(value = "/store/plat-store/save")
	Response save(@RequestBody PlatStoreAddParamDTO platStoreAddParamDTO);

	/**
	 * 根据店铺ID获取店铺经营类目
	 *
	 * @param storeId 店铺id
	 * @return Response<List < Map < String, Object>>>
	 */
	@RequestMapping(value = "/store/store-goods-category/getCategoriesByStoreId", method = RequestMethod.GET)
	Response<List<Map<String, Object>>> getCategoriesByStoreId(@RequestParam("storeId") Long storeId);

	/**
	 * 分页查询店铺列表
	 *
	 * @param param 查询参数
	 * @return Response<Page < PlatStoreDTO>>
	 */
	@RequestMapping(value = "/store/plat-store/query/page", method = RequestMethod.POST)
	Response<Page<PlatStoreDTO>> page(@RequestBody PlatStoreQueryParam param);


	/**
	 * 根据id获取平台会员
	 *
	 * @param id ID
	 * @return Response
	 */
	@RequestMapping(value = "/usercenter/platConsumer/{id}", method = RequestMethod.GET)
	Response<ConsumerDto> getById(@PathVariable("id") Long id);

	/**
	 * 根据参数查询平台会员信息
	 *
	 * @param entity 查询参数实体
	 * @return Response<List < ConsumerDto>>
	 */
	@RequestMapping(value = "/usercenter/platConsumer/getConsumers", method = RequestMethod.POST)
	Response<List<ConsumerDto>> getConsumers(@RequestBody ConsumerDto entity);

	/**
	 * 保存平台会员信息
	 *
	 * @param entity 保存对象
	 * @return Response<Long>
	 */
	@RequestMapping(value = "/usercenter/platConsumer/save", method = RequestMethod.POST)
	Response<Long> saveConsumer(@RequestBody ConsumerDto entity);

	/**
	 * 保存平台会员账户
	 *
	 * @param entity 保存对象
	 * @return Response<Long>
	 */
	@RequestMapping(value = "/usercenter/memberAccount/save", method = RequestMethod.POST)
	Response<Long> saveMemberAccount(@RequestBody MemberAccountDto entity);

	/**
	 * 保存会员收货地址
	 *
	 * @param entity 会员收货地址实体
	 * @return Response<Long>
	 */
	@RequestMapping(value = "/usercenter/memberAddress/save", method = RequestMethod.POST)
	Response<Long> addAddress(@RequestBody MemberAddressDto entity);

	/**
	 * 修改会员收货地址
	 *
	 * @param entity 会员收货地址修改参数实体
	 * @return Response<Long>
	 */
	@RequestMapping(value = "/usercenter/memberAddress/update", method = RequestMethod.PUT)
	Response<Long> updateAddress(@RequestBody MemberAddressUpdateParam entity);

	/**
	 * 删除会员收货地址
	 *
	 * @param id 收货地址ID
	 * @return Response<Long>
	 */
	@RequestMapping(value = "/usercenter/memberAddress/delete/{id}", method = RequestMethod.DELETE)
	Response<Long> deleteAddress(@PathVariable("id") Long id);

	/**
	 * 查看会员收货地址
	 *
	 * @param entity 查询参数实体
	 * @return Response<Page < MemberAddressDto>>
	 */
	@RequestMapping(value = "/usercenter/memberAddress/list")
	Response<Page<MemberAddressDto>> viewAddress(@RequestBody MemberAddressPageParam entity);

	/**
	 * 根据ID获取收货地址信息
	 *
	 * @param id 收货地址ID
	 * @return Response<MemberAddressDto>
	 */
	@RequestMapping(value = "/usercenter/memberAddress/{id}", method = RequestMethod.GET)
	Response<MemberAddressDto> getAddressById(@PathVariable("id") Long id);


	/**
	 * 根据id获取租户
	 *
	 * @param id ID
	 * @return Response
	 */
	@RequestMapping(value = "/company/company/{id}", method = RequestMethod.GET)
	Response<CompanyDto> getByCompanyId(@PathVariable("id") Long id);

	/**
	 * 根据租户会员ID获取租户会员信息
	 *
	 * @param id 租户会员ID
	 * @return Response
	 */
	@RequestMapping(value = "/company/member/{id}", method = RequestMethod.GET)
	Response<MemberDto> getMemberById(@PathVariable("id") Long id);

	/**
	 * 保存租户会员信息
	 *
	 * @param memberDto 租户会员信息DTO
	 * @return Response
	 */
	@RequestMapping(value = "/company/member/save", method = RequestMethod.POST)
	Response<Long> saveMember(@RequestBody MemberDto memberDto);

	/**
	 * 更新租户会员信息
	 *
	 * @param memberDto 租户会员信息DTO
	 * @return Response
	 */
	@RequestMapping(value = "/company/member/update", method = RequestMethod.PUT)
	Response<Long> updateMember(@RequestBody MemberDto memberDto);

	/**
	 * 根据WxOpenId查询租户会员
	 *
	 * @param wxOpenId 微信用户唯一id
	 * @return Response<MemberDto>
	 */
	@RequestMapping(value = "/company/member/getMemberByWxOpenId", method = RequestMethod.GET)
	Response<MemberDto> getMemberByWxOpenId(@RequestParam("wxOpenId") String wxOpenId);

	/**
	 * 根据手机号码查询租户会员
	 *
	 * @param mobile 手机号码
	 * @return Response<MemberDto>
	 */
	@RequestMapping(value = "/company/member/getMemberByMobile", method = RequestMethod.GET)
	Response<MemberDto> getMemberByMobile(@RequestParam("companyId")Long companyId,@RequestParam("mobile") String mobile);

	/**
	 * 根据微信openId和手机号码获取租户会员信息
	 *
	 * @param wxOpenId 微信openId
	 * @param mobile   手机号码
	 * @return Response<MemberDto>
	 */
	@RequestMapping(value = "/company/member/getMemberByWxOpenIdOrMobile", method = RequestMethod.GET)
	Response<MemberDto> getMemberByWxOpenIdOrMobile(@RequestParam("wxOpenId") String wxOpenId, @RequestParam("mobile") String mobile);

	/**
	 * 查询租户会员信息和平台会员信息
	 *
	 * @param param 查询参数
	 * @return Response<Map < String, Object>>
	 */
	@RequestMapping(value = "/company/member/getMemberWithConsumerInfo", method = RequestMethod.POST)
	Response<Map<String, Object>> getMemberWithConsumerInfo(@RequestBody Map<String, Object> param);


	/**
	 * 根据参数查找租户会员信息
	 *
	 * @param param 查询参数
	 * @return Response<List < MemberDto>>
	 */
	@RequestMapping(value = "/company/member/getMembers", method = RequestMethod.POST)
	Response<List<MemberDto>> getMembers(@RequestBody MemberDto param);

}
